// 2025/8/25
// ruby和薯条

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long atMostK(vector<int> a, int k)
{
    long long ret = 0;
    int n = a.size();
    for(int left = 0, right = 0; right < n; right++)
    {
        while(a[right] - a[left] > k)
            left++;
        ret += right - left;
    }
    return ret;
}

int main() {
    int n, l, r; cin >> n >> l >> r;
    vector<int> a(n);
    for(auto& ai : a) cin >> ai;

    sort(a.begin(), a.end());
    long long ans = atMostK(a, r) - atMostK(a, l - 1);
    cout << ans << endl;
}
// 64 位输出请用 printf("%lld")